<template>
  <div id="bar_dv" style="width:100%;height:200px;overflow:hidden" ref="chart"></div>
</template>    

<script>
import echarts from "echarts";
export default {
  name: "myCharts",
  data() {
    return {};
  },

  mounted() {
    this.Histogram();
  },
  methods: {
    Histogram() {
      // 基于准备好的dom，初始化echarts实例
      //var bar_dv = document.getElementById('bar_dv');
      var bar_dv = this.$refs.chart;
      if (bar_dv) {
        console.log("bar_dv不为空");
        let myChart = this.$echarts.init(bar_dv);
        // 绘制图表
        myChart.setOption({
          title: { text: "校招企业汇总" },
          tooltip: {},
          xAxis: {
            data: ["1月", "2月", "3月", "4月", "5月", "6月","7月", "8月", "9月", "10月", "11月", "12月"],
          },
          yAxis: {},
          series: [
            {
              name: "新增企业",
              type: "bar",
              data: [15, 30, 76, 53, 65, 47,56,78,89,74,58,66],
            },
          ],
        });
      }
    },
  },
};
</script>
<style lang="less">

</style>